package com.qf.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.ssm.mapper.EmpMapper;
import com.qf.ssm.po.Emp;
import com.qf.ssm.qo.StoreQo;
import com.qf.ssm.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EmpServiceImpl implements EmpService {
    @Autowired
    EmpMapper empMapper;
    @Override
    public PageInfo<Emp> empList(int page, int size, StoreQo storeQo) {
        PageInfo<Emp> pageInfo = PageHelper.startPage(page,size).doSelectPageInfo(
                ()-> empMapper.selectEmpByKeyWord(storeQo.getDelStatus(),storeQo.getKeyWord())
        );
        return pageInfo;
    }

    @Override
    public Integer empRegister(Emp emp) {
        return empMapper.insertEmp(emp);
    }

    @Override
    public Integer empDimission(String empName) {
        return empMapper.deleteEmp(empName);
    }

    @Override
    public Integer empModification(Emp emp) {
        return empMapper.updateEmp(emp);
    }
}
